
<html>
<head>
<script src="test.js" type="text/javascript" charset="utf-8"></script>

<title>Testing</title>
<script language="Javascript"> 

var ind = 0;
var ind2 = 0;
var ind3 = 0;
var c = 0;
var cat = 0;

function Next1() {

   var div1 = document.getElementById("div1");
   
   div1.childNodes[2].nodeValue="Event: " + events.bwEventList.events[ind].summary;
   
   div1.childNodes[4].nodeValue="Date: " + events.bwEventList.events[ind].start.longdate;
   
   div1.childNodes[6].nodeValue="Category: " + events.bwEventList.events[ind].categories[0];
   
   
   ind++;
}
function Previous1() {

	if (ind > 1) {
	
		ind = ind - 2;

	   var div1 = document.getElementById("div1");
	   
	   div1.childNodes[2].nodeValue="Event: " + events.bwEventList.events[ind].summary;
	   
	   div1.childNodes[4].nodeValue="Date: " + events.bwEventList.events[ind].start.longdate;
	   
	   div1.childNodes[6].nodeValue="Category: " + events.bwEventList.events[ind].categories[0];
	   
	   ind++
   }
}

function Next2() {

   var div2 = document.getElementById("div2");
   
   div2.childNodes[2].nodeValue="Event: " + events.bwEventList.events[ind2].summary;
   
   div2.childNodes[4].nodeValue="Date: " + events.bwEventList.events[ind2].start.longdate;
   
   div2.childNodes[6].nodeValue="Category: " + events.bwEventList.events[ind2].categories[0];
   
   
   ind2++;
}
function Previous2() {

	if (ind2 > 1) {
	
		ind2 = ind2 - 2;
		
	   var div2 = document.getElementById("div2");
	   
	   div2.childNodes[2].nodeValue="Event: " + events.bwEventList.events[ind2].summary;
	   
	   div2.childNodes[4].nodeValue="Date: " + events.bwEventList.events[ind2].start.longdate;
	   
	   div2.childNodes[6].nodeValue="Category: " + events.bwEventList.events[ind2].categories[0];
	   
	   
	   ind2++;
   }
}

function Next3() {

	if (c == 1) {

	   sort(cat, ind3);
   }
}
function Previous3() {

	if (ind3 > 1 && c == 1) {

		ind3 = ind3 - 2;
		
	   var div3 = document.getElementById("div3");
	   
	   div3.childNodes[2].nodeValue="Event: " + events.bwEventList.events[ind3].summary;
	   
	   div3.childNodes[4].nodeValue="Date: " + events.bwEventList.events[ind3].start.longdate;
	   
	   div3.childNodes[6].nodeValue="Category: " + events.bwEventList.events[ind3].categories[0];
	   
	   
	   ind3++;
   }
}

function sort(category, x) {

	var found = 0;
	var i = x;
	var j = 0;
	var div3 = document.getElementById("div3");
	cat = category;
   
	while (found == 0) {
		if (events.bwEventList.events[i].categories[j] == category) {
			
			div3.childNodes[2].nodeValue="Event: " + events.bwEventList.events[i].summary;
   
			div3.childNodes[4].nodeValue="Date: " + events.bwEventList.events[i].start.longdate;
   
			div3.childNodes[6].nodeValue="Category: " + events.bwEventList.events[i].categories[j];
   
			found = 1;
			ind3 = i + 1;
			c = 1;
		}
		i++;
	}

}
</script>
</head>
<body>

<div ID="div1">
	<div ID="div1_1"> </div>
	<div ID="div1_2"> </div>
	<div ID="div1_3"> </div>
	<script language="Javascript">
		Next1();
	</script>

	<form name="form">
	<input type="button" value="Previous"
		onClick="Previous1();">
	<input type="button" value="Next"
		onClick="Next1();">
	</form>

</div>

<div ID="div2">
	<div ID="div2_1"> </div>
	<div ID="div2_2"> </div>
	<div ID="div2_3"> </div>
	<script language="Javascript">
		Next2();
	</script>

	<form name="form">
	<input type="button" value="Previous"
		onClick="Previous2();">
	<input type="button" value="Next"
		onClick="Next2();">
	</form>

</div>

<div ID="div3">
	
	<div ID="div3_1"> </div>
	<div ID="div3_2"> </div>
	<div ID="div3_3"> </div>

	<form name="form1">
	<input type="button" value="Previous"
		onClick="Previous3();">
	<input type="button" value="Next"
		onClick="Next3();">
	</form>

	<form name="form2">
	<td>
	<input type="button" value="Exhibits"
		onClick="sort('Exhibits', 0);">
	</td>
	<td>
	<input type="button" value="Open Houses"
		onClick="sort('Open Houses', 0);">
	</td>
	</form>

</div>


</body>
</html>
